﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000116662228";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCghL9uNq5vvo7vM7rt2l2ar1NWuXiHEdltbmnQ+eaRumXu0Ft77xdIhy92G6O7n1BVml0NOUPph9VXpg64F+V3ut9A6N5xfdo4LAu2wIl84TaBWECov7inrBlaL3L4ayhjnK42IgWlkQUvH6/IMWo7MsdaA9xnMvSz5hiWmOueSD3GSYHErmL0kottsyiXfUeq5MS0LEkZ+kv3cgoxde64SB0AvswUCf4mA0Hq0j8Z0LUeLkT5zEKQU4uGWsVp0ZD0hRcZwP4/oEJT+JrBw8mbrdS2NyI+6hNSjJP9bqI5hgUnCL9aTyRTs4O4QXa58GeSjIhFVEFIEz5iC6T/R0QvAgMBAAECggEAYeZ05uB85XSAss2HLfhn7KcQGi3GoAK37LFR4n34LVtVPiFgGqeJONgSj2NuKkmRcpRSOnV5wR3ydaG3CnqwnqSf83PT775FcMsUXeLyN/MYDi1oSkOceM9TKxkTcwXQPWjbK/L2JLPdSI93446X7wEaawE91MdUTcCBsKAV3JPUcxiXKjmW0PmZFbz4zsGj7qh+fIN5HWY3VamoqP+KsIgdaZ07tHUZWV3V3/fFvAyZwntQdaMDKNwzdFir4cpRIMACBB7FLAyebNyyt4okm6o3EOdRjjwUyFqKR8seYXYUdZoPEF6dv74Sb6k65cWKgPixCCNDYNWvKH3id3r3KQKBgQDf4A0EfVMYuP0so9e43C7cXZz0hKzY0P9WS6NUGJOVmNhtiWX+EGSYNZxczHU8Tsz3USlGXOm9E+P5s/O+rhByzn6idri399TrzSXi8pau9CHKQzydOA08wF1Pdm1dRoK/z4L/uUKnr2ThxAwdOAxJ9isyh7lq5p9Tt6mZWdaSSwKBgQC3jVIDgijBz2tRJp8lY2f4IbT+BGHLPP0bXqAJ4ou/HcQSx0Dk6AsXpU5qNvqHU1DrKHOkPl5WWUWi6zTyajjT1cSMA1IzktoFU1Q4+6ajP17H6ryO5I/L7h1lCQKgQa2Vai6pDMvP4XQUVg+IdbaJ2JbJvh2FV5ORhkyIVf6HLQKBgQDcNpZ3cRNZATZAP9YFh8gsiYTHXO5sw4A2kWZSZW5eu59Ad+O0esmIk0uAWLmFHfot2E7iYKimjTc1uxYq3Ste0tHr2x4uEAEIBZ6b04X3CDtoqqSn/ae/t3TRoitHkgEwzd0M0F3JdhSkouRLpYMpCZVKOglgJwRYJBQWvTD8awKBgDOkkEmqals1R6V6b1ZupIb8vNanVvh+vVvhALgnRFhOQKdj5k9BNjW97dUWiOBgQakYJYk1fwdecKhI8wmtdzWqtHUMTilyjOLosg6iRx0xLDKlSc4OYqLm6OBPa6y5LeSXDm/DyOhBL461NAOZ0vTvumUil1236S4NkiTdxRI1AoGAZzsZvx7AHgX1r1ngRfe5CoTTzInd3LR4RC/dRLaPmHHPSXv2dG+uXEi7Ba+Mmum+t6fFjbFTQ9S+IBhgz0unAWKml/zdz9NbbjlKAj8ebWd0Shc61D66NmXgxbP1mU+VuYrzwGd8W31Rtl0wbiIFBg4Yk0GqXNhEG+o7ky5OC80=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoIS/bjaub76O7zO67dpdmq9TVrl4hxHZbW5p0Pnmkbpl7tBbe+8XSIcvdhuju59QVZpdDTlD6YfVV6YOuBfld7rfQOjecX3aOCwLtsCJfOE2gVhAqL+4p6wZWi9y+GsoY5yuNiIFpZEFLx+vyDFqOzLHWgPcZzL0s+YYlpjrnkg9xkmBxK5i9JKLbbMol31HquTEtCxJGfpL93IKMXXuuEgdAL7MFAn+JgNB6tI/GdC1Hi5E+cxCkFOLhlrFadGQ9IUXGcD+P6BCU/iawcPJm63UtjciPuoTUoyT/W6iOYYFJwi/Wk8kU7ODuEF2ufBnkoyIRVRBSBM+Yguk/0dELwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://spirit.free.idcfengye.com/market/notifyUrl";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://127.0.0.1:8080/market/returnUrl";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

